// V-webapp/src/api/auth.ts
import request from './request';

// 用户登录
export const login = (data: { username: string; password: string }) => {
  return request.post('/auth/login', data);
};

// 观众注册
export const register = (data: { audience_name: string; email: string; password: string; gender?: string }) => {
  return request.post('/auth/register/audience', data);
};

// 主播注册
export const anchorRegister = (data: { anchor_name: string; email: string; password: string; gender?: string }) => {
  return request.post('/auth/register/anchor', data);
};

// 获取用户信息 - 这个就是缺失的导出
export const getUserInfo = () => {
  return request.get('/auth/user-info');
};

// 退出登录
export const logout = () => {
  return request.post('/auth/logout');
};

// 获取当前用户信息（兼容接口）
export const getCurrentUser = () => {
  return request.get('/auth/me');
};

export default {
  login,
  register,
  anchorRegister,
  getUserInfo,
  logout,
  getCurrentUser
};